<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Agreement extends Model
{
    protected $table = "c_agreements";

    public function getOptions()
    {
        return [
            1 => "注册协议",
            2 => "登录协议",
            3 => "隐私协议",
            4 => "用户关注工作室协议",
            5 => "用户注销协议",
            6 => "工作室入驻协议",
            7 => "电话咨询协议",
            8 => "发票规则说明",
            9 => "工作室评价公约",
            10 => "工作室信息修改协议",
            11 => "供应商入驻协议",
            12 => "健康管家使用知情书",
            13 => "课程购买须知",
            14 => "课程售卖规则",
            15 => "免责声明",
            16 => "商品购买协议",
            17 => "上传课程相关协议",
            18 => "上架协议",
            19 => "图文咨询协议",
            20 => "商圈发布协议",
            21 => "添加医护协议",
            22 => "手机号绑定协议",
            23 => "用户退款协议",
            24 => "自营商品发布协议",
            25 => "手机号绑定协议",
            26 => "随访服务协议",
            27 => "用户服务协议",
            28 => "对账规则协议",
            29 => "上传文章规则协议",
            30 => "帮助文档",
            31 => "用户协议(医护端)",
            32 => "隐私协议(医护端)",
            33 => "押金服务协议",
        ];
    }

    /**
     * @param $type
     * @return mixed
     * 获取协议
     */
    public function getInfo($type)
    {
        $res = self::where([['type', '=', $type['cate']], ['status', '=', 1],['user_type', '=', $type['user_type']]])->orderBy("id", "desc")->first();
        if ($res) {
            return $res->toArray();
        } else {
            return [];
        }
    }
}
